1. Field of the Invention
The invention relates generally to remote procedure calls and, more particularly, to callbacks in remote procedure calls.
2. Description of the Related Art
A thread is a software construct that executes computer programs in an operating environment. A thread typically possesses a program counter, a register set and its own private stack. An address space provides the context in which a thread executes. An address space is a range of addresses used by a program. In a virtual address space, the addresses used by a program do not necessarily correspond to physical addresses of a computer system.
In a multithreaded environment, a single address space can have more than one thread simultaneously executing a program. Multithreading, for example, can involve parallel execution of a single program in a computer system, and it can involve the execution of multiple threads on behalf of different clients in a single address space.
A remote procedure call (RPC) is a procedure call in which a called routine executes in a different address space and thread than the calling routine. An RPC ordinarily involves the passing of a message from one address space to another address space. RPCs can be made to a thread in the same computer system or in a remote computer system.
While processing an RPC, a called thread sometimes creates helper threads to help in processing the call. Such helper threads execute in parallel with the original called thread. When the helper threads have completed their execution, the called thread ordinarily completes processing of the RPC call by returning results of the call to the calling thread.
A callback is a nested RPC in which either a called thread or a helper thread makes an RPC callback to the calling thread. Typically, for example, when a called thread is invoked through an RPC, information that identifies the calling thread is stored in a call block in the address space of the called thread. The identifying information in the call block is used to locate the calling thread during callbacks.
Often, information is stored in conjunction with a call block that indicates when a callback is in progress. Such information can be used, for example, to delay a callback to the calling thread until another callback by another thread has been completed.
Furthermore, status information frequently is stored in conjunction with a call block that indicates whether an RPC call represented by the call block has completed. After the call has completed, helper threads are precluded from calling back to the calling thread.
While earlier systems and methods for using RPC callbacks generally have been successful, there have been shortcomings with their use. For example, such earlier systems and methods generally did not involve callbacks from helper threads in a multithreaded environment. It is desirable that an RPC mechanism service callbacks from helper threads in substantially the same manner that it services callbacks from an originally called thread.
Therefore, there has been a need for a system and a method for use in a multithreaded environment in which helper threads can invoke an RPC callback to a calling thread in substantially the same manner that an originally called thread invokes RPC callbacks to the calling thread. The present invention meets this need.